#include "laurin-ip-network-client.h"
#include "../laurin-utils.h"


LaurinIPNetworkClient::LaurinIPNetworkClient(u_int32_t ip, u_int8_t* mac)
{
	_ip = ip;
	setMAC(mac);
}


LaurinIPNetworkClient::LaurinIPNetworkClient(const LaurinIPNetworkClient& client)
{
	_ip = client._ip;
	setMAC(client._mac);
}

LaurinIPNetworkClient::~LaurinIPNetworkClient()
{
	if(_mac)
		free(_mac);
}


u_int32_t LaurinIPNetworkClient::getIP() const
{
	return _ip;
}


u_int8_t* LaurinIPNetworkClient::getMAC() const
{
	return _mac;
}


void LaurinIPNetworkClient::setMAC(u_int8_t* mac)
{
	if(!mac)
		return;

	_mac = (u_int8_t*) malloc(ETH_ALEN);
	memcpy(_mac, mac, ETH_ALEN);

}
